package cn.code.auth.authorize.security;


import cn.code.auth.authorize.model.AuthTbRolePower;
import org.springframework.security.core.GrantedAuthority;

import java.util.List;

/**
 * Created by 汪玉东 on 2017/11/6.
 */
public class MyGrantedAuthority implements GrantedAuthority {
    private Integer id;
    private String roleName;
    private List<AuthTbRolePower> powers;


    public MyGrantedAuthority(Integer id, String roleName, List<AuthTbRolePower> powers) {
        this.id = id;
        this.roleName = roleName;
        this.powers = powers;
    }

    public MyGrantedAuthority() {
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public List<AuthTbRolePower> getPowers() {
        return powers;
    }

    public void setPowers(List<AuthTbRolePower> powers) {
        this.powers = powers;
    }

    @Override
    public String getAuthority() {
        return this.toString();
    }

    @Override
    public String toString() {
        return "MyGrantedAuthority{" +
                "id=" + id +
                ", roleName='" + roleName + '\'' +
                ", powers=" + powers +
                '}';
    }
}
